-
-
Notifications
You must be signed in to change notification settings - Fork 226
Add shell command action with root mode support and test functionality #1850
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: sds100 <[email protected]>
Co-authored-by: sds100 <[email protected]>
Co-authored-by: sds100 <[email protected]>
Co-authored-by: sds100 <[email protected]>
sds100
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot can you implement this review.
base/src/main/java/io/github/sds100/keymapper/base/actions/ShellCommandActionScreen.kt
Show resolved
Hide resolved
|
|
||
| testResult = when (result) { | ||
| is Success -> State.Data(result.data) | ||
| is KMError -> State.Data("Error: ${formatError(result)}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot use KMError.getFullMessage() which requires a ResourceProvider
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated error handling to use KMError.getFullMessage(resourceProvider) for consistent, localized error messages. Added ResourceProvider to ViewModel constructor. (commit: in progress)
base/src/main/java/io/github/sds100/keymapper/base/actions/ActionData.kt
Show resolved
Hide resolved
Co-authored-by: sds100 <[email protected]>
…the ShellCommandActionScreen
Shell Command Action Feature Implementation ✅
Requirements from Issue
Recent Changes
ShellCommandActionStatedata class instead of separate parametersKMError.getFullMessage()with ResourceProvider for better error messagesImplementation Summary
The shell command action feature has been fully implemented with the following capabilities:
User Interface:
Technical Implementation:
ShellCommandActionStatedata class for cleaner state managementShellAdapterfor normal shell commandsSuAdapterfor root commands (requires root permission)KMError.getFullMessage()for consistent localizationFiles Modified/Created:
ActionId.kt- Added SHELL_COMMAND action IDActionData.kt- Added ShellCommand data classActionUtils.kt- Added category, title, icon mappings, and isEditableCreateActionDelegate.kt- Added configuration logicPerformActionsUseCase.kt- Added execution logicstrings.xml- Added new string resourcesShellCommandActionScreen.kt- Full-screen UI with ShellCommandActionStateConfigShellCommandViewModel.kt- ViewModel with state management and ResourceProviderNavDestination.kt- Added ConfigShellCommand navigation destinationBaseMainNavHost.kt- Registered shell command screen in navigationSuAdapter.kt- Added executeWithOutput method for root commands with output captureActionUiHelper.kt- Added shell command description display logicShellCommandActionTest.kt- Unit tests for shell command actionActionEntity.kt- Added SHELL_COMMAND type and ACTION_FLAG_SHELL_COMMAND_USE_ROOT flagActionDataEntityMapper.kt- Added conversion logic for database persistenceOriginal prompt
Fixes #661
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.